import base from "./base";
import axios from "@/request/request";
import myaxios from 'axios';

const api = {
    // 1.首页顶部数据统计
    getHomeCount() {
        return axios.get(base.homeCount);
    },
    // 2.首页图标绘制
    getHomeFormat() {
        return axios.get(base.homeFormat);
    },
    // 3.订单信息
    getHomeOrder() {
        return axios.get(base.homeOrder);
    },
    // 4.产品列表 page
    getGoodsList(params) {
        return axios.get(base.goodsList, {params});
    },
    // 5.产品查询 search
    getGoodsSearch(params) {
        return axios.get(base.goodsSearch, {params});
    },
    // 6.删除商品
    deleteGoods(params) {
        return axios.get(base.deleteGoods, { params });
    },
    // 7.商品类目选中 type
    goodsItemCategory(params) {
        return axios.get(base.goodsItemCategory, {params});
    },
    // 8.addGoods 商品添加
    addGoods(params) {
        return axios.get(base.addGoods, {params});
    },
    // 9.商品修改
    changeGoods(params) {
        return axios.get(base.changeGoods, {params});
    },
    // 10.batchDelete 批量删除
    // ids={1, 2, 3} 字符串 [1, 2, 3]=>转成字符串的格式
    batchDelete(params) {
        return axios.get(base.changeGoods, {params});
    },
    // 11.富文本上传图片
    // batchUpload    myaxios  axios本身  无二次封装
    batchUpload(params) {
        return myaxios.post(base.batchUpload,  params);
    },
    // 12.产品列表分类
    itemCategory() {
        return axios.get(base.itemCategory);
    },
    // 13.产品类目
    insertCategory(params) {
        return axios.get(base.insertCategory, {params});
    },
    // 14.修改一级分类名称 name id
    updateCategory(params) {
        return axios.get(base.updateCategory, {params});
    },
    // 15.删除分类名称 deleteContentCategoryById
    deleteContentCategoryById(params) {
        return axios.get(base.deleteContentCategoryById, { params });
    },
    // 16.新增子类名称  cid name
    insertItemCategory(params) {
        return axios.get(base.insertItemCategory, {params});
    },
    // 17.登录  name pwd
    login(params) {
        return axios.post(base.login, params);
    },
    // 18.用户权限  token
    permission(params) {
        return axios.get(base.permission, {params});
    }
}

export function permission(params) {
    return axios.get(base.permission, { params });
}

export default api;